package main

import "fmt"

var arr = make([]int, 0)

func main() {

	for i := 0; i < 10; i++ {
		arr = append(arr, i)
	}
	fmt.Println(arr)
	fmt.Println(">>>>>>>>>>")
	arr = arr[:len(arr)-1]
	fmt.Println(arr)
	fmt.Println(len(arr))

	fmt.Println(">>>>")
	slice := make([]int, 0)
	slice = append(slice, 1)
	slice = append(slice, 1)
	slice = append(slice, 1)
	slice = append(slice, 1)
	slice = append(slice, 1)
	count := cap(slice)
	fmt.Println(count)
	slice[6] = 0
}

func funcName() {
	names := [5]string{"name1", "name2", "name3", "name4", "name5"}

	for _, item := range names {
		fmt.Println("array >>> " + item)
	}

	nameSlice := names[1:4]
	fmt.Println(">>>> before >>>")
	PrintSlice(nameSlice)

	fmt.Println(">>>> change array item  >>>>>")
	names[3] = "test"
	PrintSlice(nameSlice)

	fmt.Println(">>>>> change slice item >>>> array for: ")
	nameSlice[2] = "slice change"
	for _, arrayItem := range names {
		fmt.Println("array item >>>> " + arrayItem)
	}
}

func PrintSlice(sliceArray []string) {
	for _, item := range sliceArray {
		fmt.Println("slice item >>>> " + item)
	}
}
